﻿using System;
using System.ComponentModel;

namespace Borg
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
    public class SlotAttribute : Attribute
    {
        [CodeSupportDescription(Accelerator = '1', Group = "Event", MethodPostFix = "_Opening", Order = 1)]
        public string OnOpening = string.Empty;

        [CodeSupportDescription(Accelerator = '2', Group = "Event", MethodPostFix = "_Opened", Order = 2)]
        public string OnOpened = string.Empty;

        [CodeSupportDescription(Accelerator = '3', Group = "Event", MethodPostFix = "_Registering", Order = 3)]
        public string OnRegistering = string.Empty;

        [CodeSupportDescription(Accelerator = '4', Group = "Event", MethodPostFix = "_Registered", Order = 4)]
        public string OnRegistered = string.Empty;

        [CodeSupportDescription(Accelerator = '5', Group = "Event", MethodPostFix = "_Plugging", Order = 5)]
        public string OnPlugging = string.Empty;

        [CodeSupportDescription(Accelerator = '6', Group = "Event", MethodPostFix = "_PluggingCanceled", Order = 6)]
        public string OnPluggingCanceled = string.Empty;

        [CodeSupportDescription(Accelerator = '7', Group = "Event", MethodPostFix = "_Plugged", Order = 7)]
        public string OnPlugged = string.Empty;

        [CodeSupportDescription(Accelerator = '8', Group = "Event", MethodPostFix = "_SelectionChanged", Order = 8)]
        public string OnSelectionChanged = string.Empty;

        [CodeSupportDescription(Accelerator = '9', Group = "Event", MethodPostFix = "_UnPlugging", Order = 9)]
        public string OnUnplugging = string.Empty;

        [CodeSupportDescription(Accelerator = '0', Group = "Event", MethodPostFix = "_UnPlugged", Order = 10)]
        public string OnUnplugged = string.Empty;

        [CodeSupportDescription(Accelerator = 'A', Group = "Event", MethodPostFix = "_Deregistering", Order = 11)]
        public string OnDeregistering = string.Empty;

        [CodeSupportDescription(Accelerator = 'B', Group = "Event", MethodPostFix = "_Deregistered", Order = 12)]
        public string OnDeregistered = string.Empty;

        [CodeSupportDescription(Accelerator = 'C', Group = "Event", MethodPostFix = "_Closing", Order = 13)]
        public string OnClosing = string.Empty;

        [CodeSupportDescription(Accelerator = 'D', Group = "Event", MethodPostFix = "_Closed", Order = 14)]
        public string OnClosed = string.Empty;

        public string Name;
        public string DerivedFrom;

        [DefaultValue(typeof(bool), "true")]
        [CodeSupportDescription(Accelerator = 'O', Group = "Property", Order = 1)]
        public bool AutoOpen;

        [CodeSupportDescription(Accelerator = 'R', Group = "Property", Order = 2)]
        [DefaultValue(typeof(bool), "true")]
        public bool AutoRegister;

        [CodeSupportDescription(Accelerator = 'P', Group = "Property", Order = 3)]
        [DefaultValue(typeof(bool), "true")]
        public bool AutoPlug;

        [CodeSupportDescription(Accelerator = 'L', Group = "Property", Order = 4)]
        [DefaultValue(typeof(bool), "false")]
        public bool LazyLoad;

        [DefaultValue(typeof(bool), "false")]
        [CodeSupportDescription(Accelerator = 'M', Group = "Property", Order = 5)]
        public bool Multiple;

        [CodeSupportDescription(Accelerator = 'T', Group = "Property", Order = 6)]
        [DefaultValue(typeof(bool), "true")]
        public bool AutoRelease;

        [CodeSupportDescription(Accelerator = 'U', Group = "Property", Order = 7)]
        [DefaultValue(typeof(bool), "false")]
        public bool Unique;

        [DefaultValue(typeof(SelectionMode), "Single")]
        [CodeSupportDescription(Accelerator = 'I', Group = "Property", Order = 8)]
        public SelectionMode SelectionMode;

        public SlotAttribute(string slot)
        {
            Name = slot;
            AutoOpen = true;
            AutoPlug = true;
            AutoRegister = true;
            AutoRelease = true;
        }
    }
}

